<?php 
session_start();include "conn.php";
?>
<?php  include("admin.php");?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> Bios 管理中心 </title>
<link href="../css/control.css" rel="stylesheet" type="text/css" />
</head>

<body>
<a name="top" id="top"></a>
<div id="all"><!--Wrap start //-->
<div id="main" class="clearfix"><!--main start //-->
<div id="top-1"><?php include_once('blog_top_btn.php');?>
</div>
 <!--contact-admin start //-->
 <form action="" method="post" name="form1">
 <div id="contact-admin-ip-ser-1">
<?php if($_POST["search"]!=""){?> 查尋結果如下<?php }?>
 </div>
<div id="contact-admin-ip-ser-2">
 <select name="type" class="keyin"  >
            <option selected="selected" value="1">帳號</option>
            <option value="2">姓名</option>
          </select>
       
              <input name="title" type="text"   />
              <input name="search" type="submit"  value="查詢" />
           
 </div>
 
 </form>
 
 
 
 
 
 
 
 
 
 
 
 
 <div id="contact-admin-ip">



<?php 

$webname="ip";
$type=make_safe($_POST["type"]);
$title=make_safe($_POST["title"]);

   if($page){
    $page_size=20;
	$sql="select count(*) as total from ".$webname." where id>0 ";

    if($type=="1"){$sql=$sql." and username like '%".$title."%'";}
	if($type=="2"){$sql=$sql." and name like '%".$title."%'";}
	
	$result=mysql_query($sql);
    $message_count=mysql_result($result,0,"total");
    $page_count=ceil($message_count/$page_size);	
    $offset=($page-1)*$page_size;	
	$sql="select * from ".$webname." where id>0 ";
	
	if($type=="1"){$sql=$sql." and username like '%".$title."%'";}
	if($type=="2"){$sql=$sql." and name like '%".$title."%'";}
	
	$sql=$sql."order by id desc limit $offset, $page_size";
	$result=mysql_query($sql);
	while ($row=mysql_fetch_object($result)){
	?>
   <table border="0" cellspacing="0" cellpadding="0">
     <tr>
       <td>帳號：<?php echo $row->username;?></td>
     </tr>
     <tr>
       <td>來源IP：<?php echo $row->ip;?></td>
     </tr>
     <tr>
       <td>時間：<?php echo $row->addtime;?></td>
     </tr>
   </table>
<?php }}?>





 </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  <!--contact-admin end //-->
 <div  align="center">
總共&nbsp;<?php echo $message_count;?> 條記錄&nbsp;&nbsp;頁次：
			  <?php 
			  $BigClassName=make_safe($_GET["BigClassName"]);
			  $BigClassName=urlencode($BigClassName);
			  if($page!=1)
				   {
				     echo  "<a href=?page=1&BigClassName=".$BigClassName.">首頁</a>&nbsp;&nbsp;&nbsp;";
					 echo "<a href=?page=".($page-1)."&BigClassName=".$BigClassName.">上一頁</a>&nbsp;&nbsp;&nbsp;";
				   } echo $page;?> / <?php echo $page_count;?> 頁&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
              <?php
	  		  
				  if($page<$page_count)
				   {
				        echo "<a href=?page=".($page+1)."&BigClassName=".$BigClassName.">下一頁</a>&nbsp;&nbsp;&nbsp;";
				        echo  "<a href=?page=".$page_count."&BigClassName=".$BigClassName.">尾頁</a>&nbsp;&nbsp;&nbsp;&nbsp;";
				   
				   }
				   
				 
				?>
                 &nbsp;&nbsp;&nbsp;跳轉到
                 <script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
                 <select name="jumpMenu" id="jumpMenu" onChange="MM_jumpMenu('self',this,0)">
                 
                 <?php 
				 for($i=1;$i<=$page_count;$i++){
				 ?>
                   <option value="?page=<?php echo $i;?>" <?php if($page==$i){echo "selected";}?>><?php echo $i;?></option>
                   <?php }?>
                   </select>頁


 
  </div>
  
</div><!-- main end //-->
</div><!--Wrap end //-->
<div id="botton">
 <?php include_once('admin_botton_btn.php');?>
</div>
</body>
</html>
